summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2024-01-20 01:37:25 +0100
committerLiam <byteslice@airmail.cc>2024-01-23 03:18:52 +0100
commit96833cd809399c46bc9542e4e39b86cc496a6831 (patch)
tree66478fa6335abea2f6c221bf068468c6ef7f86f7
parentMerge pull request #12753 from liamwhite/why (diff)
downloadyuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar.gz
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar.bz2
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar.lz
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar.xz
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.tar.zst
yuzu-96833cd809399c46bc9542e4e39b86cc496a6831.zip
-rw-r--r--src/core/hle/kernel/k_page_table_base.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_page_table_base.cpp b/src/core/hle/kernel/k_page_table_base.cpp
index 3f0a39d33..1dd86fb3c 100644
--- a/src/core/hle/kernel/k_page_table_base.cpp
+++ b/src/core/hle/kernel/k_page_table_base.cpp
@@ -69,9 +69,14 @@ public:
};
template <typename AddressType>
-void InvalidateInstructionCache(KernelCore& kernel, AddressType addr, u64 size) {
+void InvalidateInstructionCache(KernelCore& kernel, KPageTableBase* table, AddressType addr,
+ u64 size) {
// TODO: lock the process list
for (auto& process : kernel.GetProcessList()) {
+ if (std::addressof(process->GetPageTable().GetBasePageTable()) != table) {
+ continue;
+ }
+
for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) {
auto* interface = process->GetArmInterface(i);
if (interface) {
@@ -1302,7 +1307,7 @@ Result KPageTableBase::UnmapCodeMemory(KProcessAddress dst_address, KProcessAddr
bool reprotected_pages = false;
SCOPE_EXIT({
if (reprotected_pages && any_code_pages) {
- InvalidateInstructionCache(m_kernel, dst_address, size);
+ InvalidateInstructionCache(m_kernel, this, dst_address, size);
}
});
@@ -2036,7 +2041,7 @@ Result KPageTableBase::SetProcessMemoryPermission(KProcessAddress addr, size_t s
for (const auto& block : pg) {
StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize());
}
- InvalidateInstructionCache(m_kernel, addr, size);
+ InvalidateInstructionCache(m_kernel, this, addr, size);
}
R_SUCCEED();
@@ -3277,7 +3282,7 @@ Result KPageTableBase::WriteDebugMemory(KProcessAddress dst_address, KProcessAdd
R_TRY(PerformCopy());
// Invalidate the instruction cache, as this svc allows modifying executable pages.
- InvalidateInstructionCache(m_kernel, dst_address, size);
+ InvalidateInstructionCache(m_kernel, this, dst_address, size);
R_SUCCEED();
}